package collectTest;

import java.awt.datatransfer.StringSelection;
import java.util.*;
import java.util.function.Consumer;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public class collectionTest {
    public static void main(String[] args) {
        List<Student> students = new ArrayList<>();
        Student s1 = new Student("yyx", 22, 100);
        Student s2 = new Student("yyy", 21, 90);
        Student s3 = new Student("xxx", 19, 98);
        Student s4 = new Student("xxx", 20, 95);
        Collections.addAll(students, s1, s2, s3, s4);

        // 把分数超过90分的存入一个数组中
        Object[] arr = students.stream().filter(s -> s.getScore() > 95).toArray();
        System.out.println(Arrays.toString(arr));

    }
}
